home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HTBasic 9.3
/
HTBasic 9.3.iso
/
83win
/
data1.cab
/
Basic_Plus_Examples
/
SYSTDIS
< prev
next >
Wrap
Text File
|
2001-03-02
|
6KB
|
147 lines
10 ! *****************************************************
20 ! Example: SYSTEM Widget Event Disabling
30 !
40 ! This program builds a set of widgets using the
50 ! SYSTEM widget. You can enable/disable ten events.
60 ! In addition, a status log lists all events that
70 ! occur, such as moving the SLIDER bar, etc.
80 !
90 ! NOTE
100 !
110 ! You may need to maximize the display to see all
120 ! of the widgets.
130 !
140 ! *****************************************************
150 !
160 DIM Sys_menu$(0:13)[80],Event$(1:2)[80],Panel$[80]
170 DIM Printer$[80],Slider$[80],Meter$[80]
180 INTEGER I,Space,Sys_event,Cur_event,Events
190 DATA ACTIVATED, ALARM, CHANGED, DONE, INVALID NUMBER
200 DATA KEYSTROKE, REPAINT, RESIZED, RETURN, SELECTION, *
210 Events=0
220 LOOP
230 Sys_menu$(Events)="DISABLE "
240 READ Sys_menu$(Events)[9]
250 EXIT IF Sys_menu$(Events)[9]="*"
260 Events=Events+1
270 END LOOP
280 Sys_menu$(Events)="Quit "
290 REDIM Sys_menu$(0:Events)
300 Panel$="Panel"
310 Printer$=Panel$&"/Printer"
320 Slider$=Panel$&"/Slider"
330 Meter$=Panel$&"/Meter"
340 !
350 ASSIGN @Syst TO WIDGET "SYSTEM"
360 CONTROL @Syst;SET ("*LOAD":"HELP_EX/SBEVNTSA.SCR","*QUEUE EVENTS":1)
370 CONTROL @Syst;SET ("*NAME":"Panel","SYSTEM MENU":Sys_menu$(*))
380 CONTROL @Syst;SET ("SIZE CONTROL":"RESIZE CHILDREN")
390 ON EVENT @Syst,"SYSTEM MENU" GOSUB Sys_menu
400 ON Events GOTO E0,E1,E2,E3,E4,E5,E6,E7,E8,E9,E10,E11,E12
410 !
420 E12: ON EVENT @Syst,Sys_menu$(12)[POS(Sys_menu$(12)," ")+1] GOSUB Event_12
430 E11: ON EVENT @Syst,Sys_menu$(11)[POS(Sys_menu$(11)," ")+1] GOSUB Event_11
440 E10: ON EVENT @Syst,Sys_menu$(10)[POS(Sys_menu$(10)," ")+1] GOSUB Event_10
450 E9: ON EVENT @Syst,Sys_menu$(9)[POS(Sys_menu$(9)," ")+1] GOSUB Event_9
460 E8: ON EVENT @Syst,Sys_menu$(8)[POS(Sys_menu$(8)," ")+1] GOSUB Event_8
470 E7: ON EVENT @Syst,Sys_menu$(7)[POS(Sys_menu$(7)," ")+1] GOSUB Event_7
480 E6: ON EVENT @Syst,Sys_menu$(6)[POS(Sys_menu$(6)," ")+1] GOSUB Event_6
490 E5: ON EVENT @Syst,Sys_menu$(5)[POS(Sys_menu$(5)," ")+1] GOSUB Event_5
500 E4: ON EVENT @Syst,Sys_menu$(4)[POS(Sys_menu$(4)," ")+1] GOSUB Event_4
510 E3: ON EVENT @Syst,Sys_menu$(3)[POS(Sys_menu$(3)," ")+1] GOSUB Event_3
520 E2: ON EVENT @Syst,Sys_menu$(2)[POS(Sys_menu$(2)," ")+1] GOSUB Event_2
530 E1: ON EVENT @Syst,Sys_menu$(1)[POS(Sys_menu$(1)," ")+1] GOSUB Event_1
540 E0: ON EVENT @Syst,Sys_menu$(0)[POS(Sys_menu$(0)," ")+1] GOSUB Event_0
550 !
560 LOOP
570 WAIT FOR EVENT
580 END LOOP
590 !
600 Event_0: Cur_event=0
610 GOSUB Event_handler
620 RETURN
630 !
640 Event_1: Cur_event=1
650 GOSUB Event_handler
660 RETURN
670 !
680 Event_2: Cur_event=2
690 GOSUB Event_handler
700 RETURN
710 !
720 Event_3: Cur_event=3
730 GOSUB Event_handler
740 RETURN
750 !
760 Event_4: Cur_event=4
770 GOSUB Event_handler
780 RETURN
790 !
800 Event_5: Cur_event=5
810 GOSUB Event_handler
820 RETURN
830 !
840 Event_6: Cur_event=6
850 GOSUB Event_handler
860 RETURN
870 !
880 Event_7: Cur_event=7
890 GOSUB Event_handler
900 RETURN
910 !
920 Event_8: Cur_event=8
930 GOSUB Event_handler
940 RETURN
950 !
960 Event_9: Cur_event=9
970 GOSUB Event_handler
980 RETURN
990 !
1000 Event_10: Cur_event=10
1010 GOSUB Event_handler
1020 RETURN
1030 !
1040 Event_11: Cur_event=11
1050 GOSUB Event_handler
1060 RETURN
1070 !
1080 Event_12: Cur_event=12
1090 GOSUB Event_handler
1100 RETURN
1110 !
1120 Event_handler:!
1130 CONTROL @Syst;SET ("*EVENT NAME FILTER":Sys_menu$(Cur_event)[POS(Sys_menu$(Cur_event)," ")+1])
1140 LOOP
1150 STATUS @Syst;RETURN ("*QUEUED EVENT":Event$(*))
1160 EXIT IF NOT LEN(Event$(2))
1170 IF Event$(1)=Slider$ THEN
1180 STATUS @Syst;RETURN ("*NAME":Slider$,"VALUE":Value)
1190 CONTROL @Syst;SET ("*NAME":Meter$,"VALUE":Value)
1200 END IF
1210 CONTROL @Syst;SET ("*NAME":Printer$,"APPEND TEXT":Event$(1)&":"&Event$(2))
1220 END LOOP
1230 CONTROL @Syst;SET ("*EVENT NAME FILTER":"")
1240 RETURN
1250 !
1260 Sys_menu:!
1270 STATUS @Syst;RETURN ("*NAME":Panel$,"SYSTEM MENU EVENT":Sys_event)
1280 Space=POS(Sys_menu$(Sys_event)," ")
1290 SELECT Sys_menu$(Sys_event)[1,Space-1]
1300 CASE "ENABLE"
1310 ENABLE EVENT @Syst,Sys_menu$(Sys_event)[Space+1]
1320 Action$="DISABLE"
1330 CASE "DISABLE"
1340 DISABLE EVENT @Syst,Sys_menu$(Sys_event)[Space+1]
1350 Action$="ENABLE"
1360 CASE "Quit"
1370 STOP
1380 END SELECT
1390 CONTROL @Syst;SET ("*NAME":Printer$,"APPEND TEXT":Sys_menu$(Sys_event))
1400 Sys_menu$(Sys_event)=Action$&Sys_menu$(Sys_event)[Space]
1410 CONTROL @Syst;SET ("*NAME":"Panel","SYSTEM MENU":Sys_menu$(*))
1420 CONTROL @Syst;SET ("*EVENT NAME FILTER":"SYSTEM MENU")
1430 STATUS @Syst;RETURN ("*FLUSH QUEUED EVENTS":Events)
1440 CONTROL @Syst;SET ("*EVENT NAME FILTER":"")
1450 RETURN
1460 END